Questions about friend function in cPP programming of Peking University

Video address ideo/av12638525/?p=22" rel=" nofollow noreferrer "> cPP programming after 3 minutes and 31 seconds, I talked about the friend function. There is no problem. Here I have the following questions:

-sharpinclude <iostream>
using namespace std;

class B{
public:
    void function();
};

class A{
    friend void B::function();
};

int main()
{
    A a;
    a.function();
    return 0;
}
The

video begins to say that in addition to the friend function, isn"t the above form a friend function? In the video, it is said that the function function in class B can be accessed through class A. isn"t this form the friend function mentioned earlier? Is there something wrong with me?
the above demo clearly causes a compilation error, indicating that none of the member functions in An are called function.

CPP
Jun.23,2022

function () is a member function of class B , not a member function of class A .

  CSDN: about CPP friends and prestatements  

Menu