If I have
namespace A
{
template<class T>
inline void SomeFunc(T& archive, Object* object)
{
// ...
}
}
and a non-template class
namespace B
{
class Manager
{
// ...
template <typename T, typename U> friend void A::SomeFunc(T& t, U* u);
};
}
why doesn't class Manager
recognize A::SomeFunc()
as a friend?
What I'm trying to do: I'm gonna have a good number of these SomeFunc
s, all taking different U
classes (which derive from the same base), so I was looking for a clean way to do it without befriending tons of these functions.
The number of template arguments matter. You are befriending a template that takes two template arguments, but the real template has only one. They are different entities.
Your friend declaration should be:
template<class T>
friend void SomeFunc(T&, Object*);