iterator class for stack