For my program, I'm trying to overload the << operator and make it a friend of the Template, but I'm getting an error when I try to build the program. My book does not at all cover how to do this, so what I am doing is based off some stuff I read online, but obviously I'm doing something wrong. Here's some of my code:
template <typename T>
friend ostream &operator<< <T>(ostream &, const Array<T> &);
// other function prototypes
//Further in the file
ostream &operator<<(ostream &out, const Array<T> &arr)
When I made a little driver for my program and built it, I got "error C2065: 'T' : undeclared identifier" and "warning C4552: '<<' : operator has no effect; expected operator with side-effect." I'm assuming that once I get the first error fixed, the second one will go away. The first error points me to the function header of the ostream operator, so something must be wrong with it. Like I said, my book is not helpful for this problem and I haven't been able to figure it out by looking it up online. It's probably something very simple, but I just can't see it. Can someone help me out?