You just can't do it. The error summarizes it well. Class templates can only be specialized in the field of namespace. class Foo not a namespace.
You can make this external to the class, as in this example, from the standard [temp.class.spec]:
Partial specialization of a template template can be declared or redefined in any area of ββthe namespace in which its definition can be defined (14.5.1 and 14.5.2). [Example:
template<class T> struct A { struct C { template<class T2> struct B { }; }; }; // partial specialization of A<T>::C::B<T2> template<class T> template<class T2> struct A<T>::C::B<T2*> { }; A<short>::C::B<int*> absip; // uses partial specialization
-end example]
source share