Overloading << operator in C++ when using templates in linked list program
问题 I'm trying to implement a linked list. But I'm receiving an error when I try overloading the << operator. This is my program: #include<iostream> #include<stdlib.h> using namespace std; template<class T> class List; template<class T> class Node { T data; Node* next; public: Node(T val) { data = val; next = NULL; } Node(T val, Node* link) { data = val; next = link; } friend class List<T>; friend ostream& operator<<(ostream& out, List<T>* li); }; template<class T> class List { Node<T>* first;