class Person
  def initialize(name, age)
    @name, @age = name, age
  end
  def <=>(other)
    age <=> other.age
  end
  attr_reader :name, :age
  protected   :age
end

p1 = Person.new("fred", 31)
p2 = Person.new("agnes", 43)
compare = (p1 <=> p2)        # -1
x = p1.age                   # Error!

