#include using namespace std; class car; class boat { private: int weight; public: boat(int w) : weight(w) {} friend int totalweight(const boat& b, const car& c); void display() const { cout << "boat's weight:" << weight << endl; } ~boat() { cout << "boat is destruction" << endl; } }; class car { private: int weight; public: car(int w) : weight(w) {} friend int totalweight(const boat& b, const car& c); void display() const { cout << "car's weight:" << weight << endl; } ~car() { cout << "car is destruction" << endl; } }; int totalweight(const boat& b, const car& c) { b.display(); c.display(); cout << "total weight:" << b.weight + c.weight << endl; return b.weight + c.weight; } int main() { int boat_weight, car_weight; cin >> boat_weight >> car_weight; boat b(boat_weight); car c(car_weight); totalweight(b, c); return 0; }