Add support for class member variable

supersedes #1417
I mean "TypeError: Cannot convert object to primitive value" after I fixed the typo.