I wana know if we can make a partial specialized class as a friend class.
template< class A, class B >
class AB{};
class C;
template < class B >
class AB< C, B >{};
class D{
template< class E > friend class AB< D, E >;
}
How to achieve the above.
This is not allowed by the C++ Standard (§14.5.3/9):
So basically, you can either make all instantiations of
ABfriend ofDor only one particular instantiation. This IBM page describes the different relationships that can be achieved when it comes to friends and templates: “one-to-one”, “one-to-many”, “many-to-one” and “many-to-many” (but not “one-to-some” as you asked).