So, I have gotten intra-class operator overloading working for obj1 + obj2:
fraction operator+ (fraction op);
Similarly, cout << obj is working by overloading operator overloading ostream:
ostream& operator<< (ostream& os, fraction& frac);
However, if I try to combine the two, all hell breaks loose.
fraction.cpp:77:27: error: no match for ‘operator<<’ in 
‘std::operator<< [with _Traits = std::char_traits<char>]((* & std::cout), ((const char*)"Sum: ")) 
<< f1.fraction::operator+(f2)’
Here is the code:
#include <iostream>
using namespace std;
class fraction
{
    private:
        int n, d;
    public:
        fraction ()
        {
            this->n = 1;
            this->d = 0;
        }
        fraction (int n, int d)
        {
            this->n = n;
            this->d = d;
        }
        int getNumerator ()
        {
            return n;
        }
        int getDenominator ()
        {
            return d;
        }
        fraction operator+ (fraction op)
        {
            return *(new fraction(this->n*op.d + op.n*this->d, this->d*op.d));
        }
        fraction operator- (fraction op)
        {
            return *(new fraction(this->n*op.d - op.n*this->d, this->d*op.d));
        }
        fraction operator* (fraction op)
        {
            return *(new fraction(this->n*op.n, this->d*op.d));
        }
        fraction operator/ (fraction op)
        {
            return *(new fraction(this->n*op.d, this->d*op.n));
        }
};
ostream& operator<< (ostream& os, fraction& frac)
{
    int n = frac.getNumerator();
    int d = frac.getDenominator();
    if(d == 0 && n == 0)
        os << "NaN";
    else if(d == 0 && n != 0)
        os << "Inf";
    else if(d == 1)
        os << n;
    else
        os << n << "/" << d;
}
int main ()
{
    fraction f1(2, 3);
    fraction f2(1, 3);
    cout << f1 << " " << f2 << endl;
    /*
    cout << "Sum: " << f1+f2 << endl;
    cout << "Difference: " << f1-f2 << endl;
    cout << "Product: " << f1*f2 << endl;
    cout << "Quotient: " << f1/f2 << endl;
    */
    return 0;
}
Help. D:
 
     
    