The code given below is related to a template concept in c++. I am not getting a proper result while passing the variables. My expected output is swapped numbers. However, the compiler is showing an error.
#include<iostream>
using namespace std;
template <class T>
void swap(T& a,T& b)
{
T temp;
temp=a;
a=b;b=temp;
}
int main()
{
int a1,b1;
cin>>a1>>b1;
swap(a1,b1);
cout<<a1<<endl<<b1<<endl;
}