Friend Function

#include<iostream.h>
#include<conio.h>


class two;
class one
{
int x;
public:
friend void avg(one,two);
void read()
{
cout<<"Enter private member of class one";
cin>>x;
}
};
class two
{
int y;
public:
friend void avg(one,two);
void input()
{
cout<<"Enter private member of class two";
cin>>y;
}
};
void avg(one o,two t)
{
cout<<(o.x+t.y)/2.0;
}
void main()
{
one o;
two t;
o.read();
t.input();
avg(o,t);
getch();
}