Question: what is the difference between friend function and virtual function?
Answer: Making a function virtual doesn't affect it at the surface level, but does make it easier for class developers to either replace it or modify it in derived classes. Friend functions are functions of any sort that have been given permission to access protected members of a class.