In this program from the accompanying slide introduce a friend function void frD(D &ad) of class D. (You can just delete the function f).
From frD access b, c, d in ad. Also from frD call the member functions Bop, Cop, and Dop on ad.
From an identical non-friend function (let us just call it an enemy) do exactly the same as in FrD.
Do you get the results you expect?
Can you arrange that frD can access/call all of b, c, d, Bop, Cop, and Dop?