#include<iostream.h>
#include<conio.h>
class base
{
int val1,val2;
public:
void getdata()
{
cout<<"Enter value 1: ";
cin>>val1;
cout<<"Enter value 2: ";
cin>>val2;
}
friend float mean (base obj);
};
float mean(base obj)
{
return float(obj.val1 + obj.val2)/2;
}
void main()
{
clrscr();
base obj;
obj.getdata();
cout<<"Mean value is:
"<<mean(obj);
getch();
}
Output