New course! Every coder should learn Generative AI!
Try a free lesson+ 5
Can any one explain
What is the problem in this program https://code.sololearn.com/ci8lyVidN3lh/?ref=app
2 Answers
+ 6
The friend function has to be a free function, you have to define it outside.
So you have to erase that B:: and it works.
void fun(A a,B b)
{
a.s=10;
cout<<"the s value is "<<a.s;
}