Q:

Can I specify that a class instance can be converted to some type?

Say I have a generic class
class Foo<T> { … }

Can I somehow specify that instances of this class can be converted to T in assignments? Example:
let foo = Foo<Int>()
func useAnInt(a: Int) {}

let getTheInt: Int = foo
useAnInt(foo)

A:

Why not just use the underlying type? (Similar to @MrBeardsley's answer)
class Foo<T> {
    var t : T

    init(t: T) {
        self.t = t
    }
}

let foo = Foo(t: 3)
func useAnInt(a: Int) {}

let getTheInt: Int = foo.t
useAnInt(foo.t)

