program for friend function in cpp
#include<iostream.h>
#include<conio.h>
class add
{
int a,b;
public:
add()
{
a=10;
b=20;
}
friend void show(add t);
};
void show(add t)
{
int c;
c=t.a+t.b;
cout<<"value of c="<<c;
}
void main()
{
clrscr();
add s;
show(s);
getch();
}