Boni wrote:
Dear all,
ist it possible to have a template class or func as friend of other
class: Folowing returns syntax errors
template< typename T> class test{};
template< typename T> int func (Ta);
class A{
friend class test;
friend int func (???);
}
It depends. Do you want all instantiations of the template to be friends of
A, or just a particular instantiation?
If you want all instantiations::
template <class T> friend int func(T a);
template <class T> friend class test;
If you want just a particular instantiation:
friend class test<A>; // ... or whatever instantiation you want
friend int func<A>(A a); // ... as above
-cd