Add support for class member variable

supersedes #1417
I think I've tried but there were some issue with the arg type, let me double check