I\'ve not coded in C++ for a long time and I\'m trying to fix some old code.
I\'m geting the error:
TOutputFile& TOutputFile::operator<<(TOutpu
Operator overloaded functions which are defined as member functions accept only one parameter. In case of overloading <<
operator, more than one parameter is required. Making it a friend
function solves this issue.
class {
...
friend TOutputFile &operator<<(TOutputFile &OutFile, const T &a);
...
};
template
TOutputFile &operator<<(TOutputFile &OutFile, const T &a) {
*OutFile.FFileID << a;
return OutFile;
}
A function marked as friend
will allow that function to access private member of the class to which it is a friend.