title: Why isn't std::optional<T>::value() a free function?
body: <p>As I know, it is recommended to use non-friend non-member functions when possible as it decouples algorithms working with the class from its private fields. Using this logic, we would probably implement <code>std::optional&lt;T&gt;::value()</code> as something like</p>
  
  <pre><code>template&lt;typename T&gt; T&amp; value(std::optional&lt;T&gt;&amp; optional) {
    if (optional.has_value()) {
      return *optional;
    } else {
      throw std::bad_optional_access("empty optional");
    }
  }
  </code></pre>
  
  <p>However, <code>value()</code> is a member function. Why? Same question can be applied to <code>std::optional&lt;T&gt;::value_or()</code>.</p>