Hello everyone. I wrote the following code where i pass by reference a class object in a friend function.Tha function just pass a value to a variable of the class object and return this variable.The compiler doesn't return any erors or warnings.
#include<iostream>
using namespace std;
class salami
{
int *a;
friend int foo(salami&);
};
int foo(salami& salam)
{
*salam.a=5;
return (*salam.a);
};
int main()
{
salami aeros;
cout<<"foo(aeros)"<<foo(aeros)<<endl;