Fix value() const to avoid returning a reference to a temporary.

(The non-const version of value() a few lines below follows this pattern already.)