error: passing xxx as 'this' argument of xxx discards qualifiers
<pre><code>#include &lt;iostream&gt;
#include &lt;set&gt;

using namespace std;

class StudentT {

public:
    int id;
    string name;
public:
    StudentT(int _id, string _name) : id(_id), name(_name) {
    }
    int getId() {
        return id;
    }
    string getName() {
        return name;
    }
};

inline bool operator&lt; (StudentT s1, StudentT s2) {
    return  s1.getId() &lt; s2.getId();
}

int main() {

    set&lt;StudentT&gt; st;
    StudentT s1(0, "Tom");
    StudentT s2(1, "Tim");
    st.insert(s1);
    st.insert(s2);
    set&lt;StudentT&gt; :: iterator itr;
    for (itr = st.begin(); itr != st.end(); itr++) {
        cout &lt;&lt; itr-&gt;getId() &lt;&lt; " " &lt;&lt; itr-&gt;getName() &lt;&lt; endl;
    }
    return 0;
}
</code></pre>

<p>In line:</p>

<pre><code>cout &lt;&lt; itr-&gt;getId() &lt;&lt; " " &lt;&lt; itr-&gt;getName() &lt;&lt; endl;
</code></pre>

<p>It give an error that:</p>

<blockquote>
  <p>../main.cpp:35: error: passing 'const StudentT' as 'this' argument of 'int StudentT::getId()' discards qualifiers</p>
  
  <p>../main.cpp:35: error: passing 'const StudentT' as 'this' argument of 'std::string StudentT::getName()' discards qualifiers</p>
</blockquote>

<p>What's wrong with this code? Thank you!</p>
