A declaration of a primary template must be in scope at the point of
declaration of the explicit specialization. In other words, an
explicit specialization declaration must appear after the declaration of the
primary template. For example, the compiler will not allow the
following:
template<> class A<int>; template<class T> class A;
An explicit specialization is in the same namespace as the definition of the primary template.
Related References