Cast lvalues to rvalue type during most comparison operations

This leads to better numeric and date comparisons, since we are comparing
actual types and not strings.