I made the following changes, but still get errors... what am I missing????
friend ostream& operator<<(ostream& os, const GamePiece& p);
friend ofstream& operator<<(ofstream& ofs, const GamePiece& p); //overloaded ofstream operator to save board & piece
friend ifstream& operator>>(ifstream& ifs, const GamePiece& p); //overloaded ostream operator to input saved board & piece
ostream& operator<<(ostream& os, const GamePiece& p)
{
os << p.pName << endl;
os << p.pType << endl;
return os;
};
ofstream& operator<<(ofstream& ofs, const GamePiece& p) //overloaded ofstream operator to save board & piece
{
ofs << p.pName << endl;
ofs << p.pType << endl;
return ofs;
};
ifstream& operator<<(ifstream& ifs, const GamePiece& p) //overloaded ostream operator to input saved board & piece
{
ifs >> p.pName >> endl;
ifs >> p.pType >> endl;
return ifs;
};
error C2678: binary '<<' : no operator defined which takes a left-hand operand of type 'class std::basic_ofstream<char,struct std::char_traits<char> >' (or there is n
o acceptable conversion)
error C2678: binary '<<' : no operator defined which takes a left-hand operand of type 'class std::basic_ofstream<char,struct std::char_traits<char> >' (or there is n
o acceptable conversion)
error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'const char [50]' (or there is no acceptable conversion)
error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'const int' (or there is no acceptable conversion)