You need to lower the variable. Therefore, print(a.socks)it should be replaced by
if a is Human {
print((a as! Human).socks)
}
or with an additional variable
if let b = a as? Human {
print(b.socks)
}
UPD:
guard:
guard let a = a as? Human
else { return }
print(a.socks)