Also... are you putting the implementation code in a separate ".cpp" file, separate from the header file? Because that can cause problems for templates.
// Example program
#include <iostream>
#include <string>
template <typename T>
class insert_object { };
template <typename Type>
class doublyLinkedList {
template <typename FriendListType>
friend std::ostream& operator<<(std::ostream& , const doublyLinkedList<FriendListType>&);
private:
insert_object<Type> insert; // just to make it compile, no idea what you intend
};
template <typename Type>
std::ostream& operator<<(std::ostream& os, const doublyLinkedList<Type>& list)
{
os << "Hello there!";
list.insert; // insert is private, so this test makes sure it's a friend
return os;
}
int main()
{
using std::string;
doublyLinkedList<int> list;
std::cout << list << '\n'; // this will use the << operator
}