I want to achieve something like the subsequent two cases:
(1) class A {
template <typename T> friend class T;
};
(2) template <typename T>
class A {
friend class T;
};
I just pulled out my copy of "C++ Templates. The Complete Guide"
(excellent, trully complete, book) and read that the type represented
by the template parameter cannot be made a friend of the template
class. It also says that such mechanism will be added in the future (?)
If you want a class template B to be a friend of A, you should make A
also a class template:
template <typename T>
class A {
friend class B<T>;
};