// File: ex6-4.cpp

#include <iostream>
using namespace std;

class Fraction
{
  private:
     int numer, denom;
  public:
    Fraction(int n = 0, int d = 1);
    void operator!() const;
  friend Fraction operator+(const Fraction&,const Fraction&);
};

Fraction::Fraction(int n, int d) : numer(n), denom(d)
{ }

void Fraction::operator!() const
{
  cout << numer << '/' << denom << endl;
}

// Fraction friend function
Fraction operator+(const Fraction& f1,const Fraction& f2)
{
  Fraction temp(f1.numer * f2.denom + f2.numer * f1.denom,f1.denom * f2.denom);
  return temp;
}

int main()
{
  Fraction f(3,4);
  Fraction g(2,3);
  Fraction h = f + g;
  !f;
  !g;
  !h;
}