Fix comparison of classes which had an attribute which would also use the AutoCompare class

Also add the unit test which reproduce the problem.