Suppose I have a template class that I am trying to declare as a friend class. Should I forward declare the class or give it its own template?
Example:
template <typename E>
class SLinkedList;
template <typename E>
class SNode {
private:
E elem;
SNode<E>* next;
friend class SLinkedList<E>;
};
Or
template <typename E>
class SNode {
private:
E elem;
SNode<E>* next;
template <typename T>
friend class SLinkedList;
};