The title basically says it all. I mainly want to do this so that I can create an object (say, a custom string object) that can initialize the parameters of other functions in other APIs. Here's an example of me trying to get a custom integer class to work:
#include <iostream>
using namespace std;
class test
{
public:
    int member;
    test(int i) : member(i) {}
    friend int &operator=(int &i, test t);
};
int &operator=(int &i, test t)
{
   return (i = t.member);
}
int main()
{
    int i;
    test t = 90;
    cout << (i = t);
    return 0;
}
Unfortunately I receive an error saying that operator= needs to be a member function. I understand the C++ standard's goal in preventing static and non-member overloads for the assignment operator from being implemented, but is there any other way to do this? Thanks for any help/suggestions!
 
     
     
     
     
     
    