// cltemp.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 prinvec(ostream &os) const {
  os << "(" << x << ", " << y << ")";
 }
 vec<T> operator+(const vec<T> &b) const {
  return vec<T>(x + b.x, y + b.y);
 }
private:
 T x, y;
};

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;
}
