// cltemp1.cpp: A class template
#include <iostream>
using namespace std;

template <class T> 
class vec {
public:
 vec(T xx = 0, T yy = 0): x(xx), y(yy) {}
 void printvec(ostream &os)const {
  os << "(" << x << ", " << y << ")";
 } // end of printvec method
 vec<T> operator+(const vec<T> &b)const {
  return vec<T>(x + b.x, y + b.y);
 } // end of overloading operator
private:
 T x, y;
}; // end of class vec

template <class T>
ostream &operator<<(ostream &os, const vec<T> &v) {
 v.printvec(os);
 return os;
}

int main() {
 vec<int> uInt(1,2), vInt(3,4), sInt;
 vec<float> uFloat(1.1F,2.2F), vFloat(3.3F,4.4F), sFloat;
 sInt = uInt + vInt;
 sFloat = uFloat + vFloat;
 cout << sInt << endl;
 cout << sFloat << endl;
 return 0;
}
