Implemented typecasting for the add method