In my C++ project I have 2 files: trip.h trip.cpp
If I want to write a helper function that takes two ints and returns the multiplication of them where should I write it and how (const, static etc...)? Note: I don't want the user to be able to use it if that is possible as in C language when we declare it as static.
if a function needs to access private members we declare it as a friend inside the class. But, should I write its title again outside the class in the .h file and write its definition in the .cpp file? Note: I was asked to make it an external function which means written outside the class.
Edit: I want answers to the exact questions above, I know I can solve this by different ways as suggested but I want to stick to this method