Rename class to klass since it is a keyword in C++.
Explicitly cast away from void* since it is not allowed by default in C++.