C++ FAQ Celebrating Twenty-One Years of the C++ FAQ!!!
(Click here for a personal note from Marshall Cline.)
Section 18:
[18.11] What's the relationship between a return-by-reference and a const member function?

If you want to return a member of your this object by reference from an inspector method, you should return it using reference-to-const, that is, X const&.

class Person {
public:
  std::string const& name_good() const;   Right: the caller can't change the name
  std::string& name_evil() const;         Wrong: the caller can change the name
  ...
};

void myCode(Person const& p)   You're promising not to change the Person object...
{
  p.name_evil() = "Igor";      ...but you changed it anyway!!
}
The good news is that the compiler will often catch you if you get this wrong. In particular, if you accidentally return a member of your this object by non-const reference, such as in Person::name_evil() above, the compiler will often detect it and give you a compile-time error while compiling the innards of, in this case, Person::name_evil().

The bad news is that the compiler won't always catch you: there are some cases where the compiler simply won't ever give you a compile-time error message.

Net: you need to think, and you need to remember the guideline in this FAQ. If the thing you are returning by reference is logically part of your this object, independent of whether it is physically embedded within your this object, then a const method needs to return by const reference or by value, but not by non-const reference. (The idea of "logically" part of your this object is related to the notion of an object's "abstract state"; see the previous FAQ for more.)