After some googling and tinkering, I've found a solution, but I can't say I understand why it works.
Why you need the second declaration is beyond me. But it works.Code:// in a header file template <typename T> class A { static stl_container<T*>* container; }; //you need a second declaration outside the body of the class //in the header template <typename T> typename A<T>::stl_container<T*>* container;