correct syntax for operator overloading in CUDA

How do you do this correctly?

I have:
Code:
struct Point2D { float x;float y; }

inline host device void operator=(Point2D& lhs, const Point2D& rhs)
{
lhs.x = rhs.x;
lhs.y = rhs.y;
}

the operator= doesn’t work on my Point2D class and returns a compile error error: “operator=” must be a member function. Obviously I don’t want to make it a member function because then the device would not be able to access it.

I notice that operator-overloading does work for the built-in CUDA structs like int2, uchar4…

You can’t overload a assignment operator outside of class scope. It must be a member function.

Yeah it was premature of me asking this question. Anyways looking at the Thrust library really helped sort out matters of using C/C++ class & structs & templates in 2.3.