/* Normal Friend Function */
#include<iostream>
using namespace std;
class Addition
{
int a,b;
public:
void accept()
{
cout<<"\n\n Enter any two number: ";
cin>>a>>b;
}
void display()
{
cout<<"\n\n A: "<<a;
cout<<"\n B: "<<b;
}
friend void add(Addition A);
};
void add(Addition A)
{
int c;
c=A.a+A.b;
cout<<"\n\n Additon: "<<c;
}
int main()
{
Addition A;
A.accept();
A.display();
add(A);
return 0;
}
#include<iostream>
using namespace std;
class Addition
{
int a,b;
public:
void accept()
{
cout<<"\n\n Enter any two number: ";
cin>>a>>b;
}
void display()
{
cout<<"\n\n A: "<<a;
cout<<"\n B: "<<b;
}
friend void add(Addition A);
};
void add(Addition A)
{
int c;
c=A.a+A.b;
cout<<"\n\n Additon: "<<c;
}
int main()
{
Addition A;
A.accept();
A.display();
add(A);
return 0;
}