template<typename> friend class foo
this will however make all templates friends to each other. But I think this is what you want?
template<typename> friend class foo
this will however make all templates friends to each other. But I think this is what you want?