#include<iostream.h>
#include<conio.h>
class data2;
class data1
{
int a,b;
public:
void get1();
friend void sum(data1,data2);
};
class data2
{
int c,d;
public:
void get2();
friend void sum(data1,data2);
};
void sum(data1 a1,data2 a2)
{
cout<<a1.a+a2.c<<endl;
cout<<a1.b+a2.d<<endl;
}
main()
{
data1 a;
data2 b;
a.get1();
b.get2();
sum(a,b);
}
void data1::get1()
{
cout<<"Enter value for a: ";
cin>>a;
cout<<"Enter value for b: ";
cin>>b;
}
void data2::get2()
{
cout<<"Enter value for c: ";
cin>>c;
cout<<"Enter value for d: ";
cin>>d;
}