 <p>You can do something like this:</p> <pre><code>func ==(lhs: Pet, rhs: Pet) -&gt; Bool { if case let Pet.cat(l) = lhs, case let Pet.cat(r) = rhs where l == r { return true } if case let Pet.dog(l) = lhs, case let Pet.dog(r) = rhs where l == r { return true } return false } </code></pre> <p>But a <code>switch</code> probably looks better and is definitely easier to maintain.</p>