14 Templates [temp]

14.5 Template declarations [temp.decls]

14.5.1 Class templates [temp.class]

14.5.1.2 Member classes of class templates [temp.mem.class]

A class member of a class template may be defined outside the class template definition in which it is declared. [ Note: The class member must be defined before its first use that requires an instantiation ([temp.inst]). For example,

template<class T> struct A {
  class B;
};
A<int>::B* b1;                  // OK: requires A to be defined but not A::B
template<class T> class A<T>::B { };
A<int>::B  b2;                  // OK: requires A::B to be defined

 — end note ]