@nikitahils, to format your code snippet, surround it with triple backticks (```) on the lines above and below.
I also observe the error you describe, using Swift 5.0.1 in an Xcode 10.3 playground as well as in the REPL.
Furthermore, I observe the following:
• Placing the declaration at the top level (outside a
func) lets it compile.
• Removing the protocol conformance “
: Equatable” lets it compile.
struct lets it compile.
This appears to be a bug, and I would recommend you file it at bugs.swift.org