Add workaround to fix issue 10567

Currently VariantN does not support const objects comparison. So just add specialized opCmp member and use cast().
Merge pull request #1405 from 9rnsr/fix10567

Add workaround to fix issue 10567