Operador de sobrecarga de inserção de CPP

struct coord {
    int x, y;

    /// take 2 inputs and put into coord, using overloaded >> operator
	friend istream& operator>>(istream& input, coord &c) {
		input >> c.x >> c.y;
		return input;
    }
	/// extract coord in point notation
	friend ostream& operator<<(ostream& output, const coord &c) {
      output << "(" << c.x << "," << c.y << ")"; // (x,y)
      return output;
   }
};

//usage:
coord pnt;
cin >> pnt; //cin contains: 1 2
cout << pnt; // (1,2)
Jealous Joey