class KotlinProducer<out T>(val value: T) { init { println(value) } } fun main() { val outValue = KotlinProducer("Just a string") val copyOfOutValue: KotlinProducer<Any> = outValue println(copyOfOutValue.value.toString()) }