The implementation of this function is almost like the print function. If it were exactly like the body of the print we would have:
ostream& operator<<(ostream& os, const Fraction& f)
{
cout << f.getNumerator() << "/" << f.getDenominator();
// But we need to return an ostream value!
}
But since cout is passed by reference, os is a alias for cout in this function. So a correct implementation is
ostream& operator<<(ostream& os, const Fraction& f)
{
os << f.getNumerator() << "/" f.getDenominator();
return os;
}