I have a assignment that construct Operator overloading with bitwise.I try to construct operator<< to shift integer left,but when I declare function is: friend const int operator<<(const int& , int& ); the complier notice error nomember operator requier a parameter with class or enum type.. So I don't operator overloading with operator<<. This is my code:
#pragma once//bitwise.h
#include<iostream>
using namespace std;
class bitwise
{ private:
int n;
public:
bitwise(int n){
this->n = n;
}
friend const int operator<<(const int& , int& );//complier notice error here.
};
const int operator<<(const int& n, int& x){
int temp=n*pow(2, x);
return temp;
}