I think you should go back to the original way:

```D
import std.c.windows.com;
import std.stdio;

interface I : IUnknown
{
    extern(D) T opCast(T)() if(is(T == void *)) { return cast(void*)0x666;}
}

class C : I
{
    extern(Windows) int QueryInterface(const(IID)* riid, void** pvObject) { return typeof(return).init; }
    extern(Windows) uint AddRef() { return 0; }
    extern(Windows) uint Release() { return 0; }
}

void main()
{
    I i = new C;
    writeln(cast(void *)i); // 666
}
```