#include <iostream>
#include <cstdlib>
using namespace std;
class Foo
{
public:
Foo(int ii=0):i(ii){}
Foo operator +(Foo& rhs)
{
return Foo(i+rhs.i);
}
operator int*(){ int* p = new int(i); return p;}
void print(){cout<<i<<endl;}
private:
int i;
};
int main()
{
Foo f(1);
Foo ff(2);
Foo re;
re = f + ff;
f.print();
re.print();
int* p= (int*)f;
cout<<*p<<endl;
system("PAUSE");
return 0;
}