I am trying to get this to work but it comes up with an error message
C2473 " operator << looks like a function definition but there is no parameter list."
Basically, this is a header file and I want to declare a namespace and a template for a class also overriding the << operator.
Please help! (I'm also new to stackoverflow and this is my first question) :)
#ifndef header
#define header
namespace nmsp{
template <class T>
class expt; //forward declaration of class, so friend function can be defined as a template
template <class T>
std::ostream& operator << (std::ostream& os, const expt <T> &input);
template <class T>
class expt {
friend std::ostream& operator << (std::ostream& os, const expt <T>& input);
private:
T *data;
public:
expt() { data = null; }
};
template <class T>
std::ostream& nmsp:: operator << (std::ostream& os, const expt <class T>& input) {
//....
}
}
}
#endif