For an assignment, I need to be able to make a templated friend class, I have the rest of the program working, but I cannot move past the errors. I am giving my code for the definition of the two classes as well as a photo of the errors. If I need to be more specific for my question, please tell me, but I honestly know slim to none about templates. Thank you.
template<class T>
class Node{
friend class NodeStack;
public:
Node();
Node(const T & data, Node<T> * next = NULL);
T & data();
const T & data() const;
public:
Node<T> * m_next;
T m_data;
};
template<class T>
class NodeStack{
template<class U>
friend std::ostream & operator<< (std::ostream & os, const NodeStack<T> & nodeStack);
public:
NodeStack();
NodeStack(size_t count, const T & value = T() );
NodeStack(const NodeStack<T> &other);
~NodeStack();
NodeStack<T> & operator=(const NodeStack<T> & rhs);
T & top();
const T & top() const;
void push(const T & value);
void pop();
size_t size() const;
bool empty() const;
bool full() const;
void clear();
void serialize(std::ostream & os) const;
private:
Node<T>* m_top;
};