#include <iostream>
using namespace std;
class sample
{
int a, b;
public:
void setvalue()
{
a=25;
b=40;
}
friend float mean (sample s);
};
float mean (sample s)
{
return (s.a+s.b)/2.0;
}
int main() {
sample x;
x. setvalue();
cout <<"mean value ="<<mean(x);
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: