template struct A { }; template struct B { typedef typename T::type type; static const type j = T::j; A b; }; struct C { typedef int type; static const int j = 3; }; int i = B::j;