Friend classes

I've have been away from C++ for a long time so I am rusty to say the least. However, I'm trying to use friend classes to share data/functions but I cannot get things to work. I've distilled my code down to the following example:

class HelperClass;

class MainClass {
  public:
    friend class HelperClass;

    //  protected:
    int a = 1;
};

class HelperClass {
  public:

};

MainClass   mClass;
HelperClass hClass;

void setup() {

  Serial.begin(115200);
  delay(1000);

  Serial.println(mClass.a); // This compiles
  Serial.println(hClass.a); // This doesn't error: 'class HelperClass' has no member named 'a'
}

void loop() {
  // put your main code here, to run repeatedly:

}

Anyone know why?

See:

OK I understand what you are saying. For grins I tried the example of a friend function in the video and it won't compile either. Any idea how to fix this?

class StankFist {
  public:
    StankFist() {
      var = 0;
    }

  private:
    int var;

    friend void stinkyFriend(StankFist &sfo);
};

void stinkyFriend(StankFist &sfo) {
  sfo.var = 99;
}

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}