trait A { fun foo(): T } class B : A { override fun foo() = "OK" } class C(a: A) : A by a fun box() = (C(B()) : A).foo()