enum class E { FIRST SECOND { class object { fun foo() = 42 } } } fun f() = E.SECOND.foo()