And this? auto ref qua(T)(Test t){ struct wrap { Test t; T opIndex(int i){ return t.opIndex!T(i); } } return wrap(t); } void main() { auto test = new Test(); writeln(test.qua!string[0], test.qua!int[0]); }