Checks for equality of two QueryTrees.
Checks for equality of a QueryTree with a value of the same type (e.g. useful to check for constants).