out.puts <<~HEREDOC
            def __hash__(self):
                return hash((#{attribute_names.map { |m| 'self.' + m }.join(", ")},))
            def __eq__(self, other: object):
                if not isinstance(other, self.__class__):