You need to use protocol inheritance:
A protocol can inherit one or more other protocols and can add further requirements on top of the requirements it inherits. The syntax for protocol inheritance is similar to the syntax for class inheritance, but with the option to list multiple inherited protocols, separated by commas.
By inheriting from Hashable, your class will need to conform to this protocol.
Also, in your specific example, you'll need to make your class final. For an explanation, see A Swift protocol requirement that can only be satisfied by using a final class
Here is an example:
protocol Groupable: Hashable {
var parent: Self? { get }
var children: Set<Self> { get }
}
final class MyGroup: Groupable {
var parent: MyGroup?
var children = Set<MyGroup>()
init() {
}
var hashValue: Int {
return 0
}
}
func ==(lhs: MyGroup, rhs: MyGroup) -> Bool {
return true
}
let a = MyGroup()