I am trying to overload the << operator, but I get the following error:
error: ambiguous overload for 'operator<<' in 'std::cout << "Test "'
..Followed by 5 billion other errors similar to:
c:\mingw\bin../lib/gcc/mingw32/4.5.2/include/c++/ostream:165:7: note: candidates are: ...
This comes up because I'm using cout in my main.cpp file.
Here is my code:
In BinTree.h:
template <typename T>
class BinTree{
...
friend std::ostream& operator<< <>(std::ostream&, const T&);
In BinTree.cpp:
template <typename T>
std::ostream& operator<< (std:: ostream& o, const T& value){
return o << value;
}
Thanks in advance for any help you can give.