title: Why is this swap function call ambiguous?
body: <p>I wanted to swap two number using a template but why does this  swap(x, y); give an error as an ambiguous call.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  template &lt;class T&gt;
  
  void swap(T &amp;a, T &amp;b) {
      T temp = a;
      a = b;
      b = temp;
  }
  
  int main () {
      int x = 14;
      int y = 7;
      swap(x, y);
      cout &lt;&lt; x &lt;&lt; y;
  }
  </code></pre>