#include <iostream>
// friend functions
// taken from: http://www.cplusplus.com/doc/tutorial/inheritance/
using namespace std;

class Rectangle {
   int width;
   int height;
   
   
   public:
   Rectangle() {
   }
   
   Rectangle(int x, int y) : width(x), height(y) {
   }
   
   int area() {
      
      return this->width * this->height;
   }
   
   friend Rectangle duplicate(Rectangle const &);
};


Rectangle duplicate(Rectangle const & param) {
   Rectangle res;
   res.width = param.width * 2;
   res.height = param.height * 2;
   
   return res;
}


int main() {
   Rectangle foo;
   Rectangle bar(2, 3);
   foo = duplicate(bar);
   cout << foo.area() << '\n';
   
   return 0;
}


template <typename T>
class A {

	friend int foo(T);
	friend class B;
	friend T;
	template <typename U>
	friend class C;
	template <typename U>
	friend A<T> & operator+=(A<T> &, U const &) {
	}
};