i am trying to write a program for friend functions but it isnt working. :(
#include <iostream>
using namespace std;
class Z;
{
private:
int a;
friend void fn();
};
void fn()
{
Z one;
one.a=5;
cout<<a<<endl;
}
int main()
{
fn();
return 0;
}
can someone please tell whats wrong with that code.