21.3 — Overloading operators using normal functions
In the previous lesson, we overloaded operator+ as a friend function: #include <iostream> class Cents { private: int m_cents{}; public: Cents(int cents) : m_cents{ cents } {} // add Cents + Cents using a friend function friend Cents operator+(const Cents& c1, const Cents& c2); int getCents() const { return m_cents; …