Or here: Overload === for custom type
By executing D(x) two times you are creating two objects stored at different memory locations. So that behavior is expected.
Since == is overloaded, you can use isequal instead:
julia> isequal(D(x), D(x))
true