using friend function add two number in c + +

using namespace std;
#include<iostream>
#include<conio.h>
#include<stdio.h>
class xyz;
class abc
{
private:
int a;
int b;
public:
void input();
friend void add(abc,xyz);
};

void abc::input()
{
cout<<"\n enter the value of a:";
cin>>a;
cout<<"\n enter the value of b:";
cin>>b;

}
class xyz

{
private:
int x;
int y;
public:
void input();
friend void add(abc,xyz);
};
void xyz::input()
{
cout<<"\n enter the value of x:";
cin>>x;
cout<<"\n enter the value of y:";
cin>>y;
}
void add(abc a1,xyz x1)
{
int t,s;
t=a1.a+x1.x;
s=a1.b+x1.y;
cout<<"\n"<<"a"<<"+"<<"x"<<"="<<t;
cout<<"\n"<<"b"<<"+"<<"y"<<"="<<s;


}
int main()
{
abc A;
xyz X;
A.input();
X.input();
add(A,X);
return 0;

}

Comments