You need to make that method const
so it can be called on a const
instance or via a const
reference:
std::string getId() const;
^^^^^
The same would apply to all Droid
methods called in std::ostream& operator<<(std::ostream &os, Droid const & a)
.
You will also need to add the const
in the method's definition.