class Foo { val bar = Bar() inner class Bar { fun baz() { println("baz!") } } } fun main(vararg args: String) { Foo().bar.baz() }