why do we need both const and non-const getters in this example
<p>I came across this example <a href="http://groups.google.com/group/comp.lang.c++.moderated/browse%5Fthread/thread/d9f7ec296d353943/6626b24459472798?show%5Fdocid=6626b24459472798" rel="nofollow">here</a>:</p>

<pre><code>#include &lt;vector&gt;
#include &lt;cstddef&gt;

template&lt;typename Tag&gt;
class Ref_t {
   std::size_t value;

   friend Tag&amp; element(Ref_t r, std::vector&lt;Tag&gt;&amp; v) {
     return v[r.value];
   }

   friend const Tag&amp; element(Ref_t r, const std::vector&lt;Tag&gt;&amp; v)
   {
     return v[r.value];
   }
public:
   // C'tors, arithmetic operators, assignment

};

struct A{};
struct B{};

typedef Ref_t&lt;A&gt; ARef_t;
typedef Ref_t&lt;B&gt; BRef_t;

int main() {
   std::vector&lt;A&gt; va;
   ARef_t ar;
   A&amp; a = element(ar, va);

}
</code></pre>

<p>So the question is why do we need -two <code>friend element</code> functions in Ref_t  class?</p>
